package com.zch.codeblock;

public class CodeBlockDetail {
    public static void main(String[] args) {
        new B();
    }
}
class A {
    private static int n1 = getVal01();
    static {
        System.out.println("A的一个静态代码块..");//2
    }
    {
        System.out.println("A的一个普通代码块..");//5
    }
    public int n2 = getVal02();
    public static int getVal01() {
        System.out.println("getVal01");//1
        return 10;
    }
    public int getVal02() {
        System.out.println("getVal02");//6
        return 10;
    }
    public A() {
        System.out.println("A的构造器");//7
    }
}

class B extends A {
    private static int n3 = getVal03();
    static {
        System.out.println("B的一个静态代码块..");//4
    }
    public int n4 = getVal04();
    {
        System.out.println("B的一个普通代码块..");//9
    }
    public static int getVal03() {
        System.out.println("getVal03");//3
        return 10;
    }
    public int getVal04() {
        System.out.println("getVal04");//8
        return 10;
    }
    public B() {
        System.out.println("B的构造器");//10
    }
}